{extend name="common@base/common" /}

{block name="style"}
<link href="__CSS__/main.min.css" rel="stylesheet" type="text/css"/>
{/block}

{block name="body"}
<div class="container">
  <ol class="breadcrumb">
      <li><a href="{:url('index/index')}">演示首页</a></li>
      <li>弹出面板</li>
  </ol>
<section class="demo-section">
<div id="pageContent">
<style>
.example-popover-static .popover
{
  position: relative;
  display: block;
  float: left;
  width: 260px;
  margin: 20px;
  z-index: 0;
}
</style>


<section><header><h3>静态类型</h3></header><article><div class="example example-popover-static clearfix">
  <div class="popover top">
    <div class="arrow"></div>
    <h3 class="popover-title">从上方弹出</h3>
    <div class="popover-content">
      <h4>江雪 <small>唐·柳宗元</small></h4>
      <p>千山鸟飞绝，万径人踪灭。</p>
      <p>孤舟蓑笠翁，独钓寒江雪。</p>
    </div>
  </div>
  <div class="popover right">
    <div class="arrow"></div>
    <h3 class="popover-title">从右侧弹出</h3>
    <div class="popover-content">
      <h4>江雪 <small>唐·柳宗元</small></h4>
      <p>千山鸟飞绝，万径人踪灭。</p>
      <p>孤舟蓑笠翁，独钓寒江雪。</p>
    </div>
  </div>
  <div class="popover bottom">
    <div class="arrow"></div>
    <h3 class="popover-title">从下方弹出</h3>
    <div class="popover-content">
      <h4>江雪 <small>唐·柳宗元</small></h4>
      <p>千山鸟飞绝，万径人踪灭。</p>
      <p>孤舟蓑笠翁，独钓寒江雪。</p>
    </div>
  </div>
  <div class="popover left">
    <div class="arrow"></div>
    <h3 class="popover-title">从左侧弹出</h3>
    <div class="popover-content">
      <h4>江雪 <small>唐·柳宗元</small></h4>
      <p>千山鸟飞绝，万径人踪灭。</p>
      <p>孤舟蓑笠翁，独钓寒江雪。</p>
    </div>
  </div>
  <div class="popover left">
    <h3 class="popover-title">不带箭头</h3>
    <div class="popover-content">
      <h4>江雪 <small>唐·柳宗元</small></h4>
      <p>千山鸟飞绝，万径人踪灭。</p>
      <p>孤舟蓑笠翁，独钓寒江雪。</p>
    </div>
  </div>
</div><pre class="pre-scrollable linenums prettyprint prettyprinted" style=""><ol class="linenums"><li class="L0"><code class="lang-html"><span class="tag">&lt;div</span><span class="pln"> </span><span class="atn">class</span><span class="pun">=</span><span class="atv">"popover top"</span><span class="tag">&gt;</span></code></li><li class="L1"><code class="lang-html"><span class="pln">  </span><span class="tag">&lt;div</span><span class="pln"> </span><span class="atn">class</span><span class="pun">=</span><span class="atv">"arrow"</span><span class="tag">&gt;&lt;/div&gt;</span></code></li><li class="L2"><code class="lang-html"><span class="pln">  </span><span class="tag">&lt;h3</span><span class="pln"> </span><span class="atn">class</span><span class="pun">=</span><span class="atv">"popover-title"</span><span class="tag">&gt;</span><span class="pln">从上方弹出</span><span class="tag">&lt;/h3&gt;</span></code></li><li class="L3"><code class="lang-html"><span class="pln">  </span><span class="tag">&lt;div</span><span class="pln"> </span><span class="atn">class</span><span class="pun">=</span><span class="atv">"popover-content"</span><span class="tag">&gt;</span></code></li><li class="L4"><code class="lang-html"><span class="pln">    </span><span class="tag">&lt;h4&gt;</span><span class="pln">江雪 </span><span class="tag">&lt;small&gt;</span><span class="pln">唐·柳宗元</span><span class="tag">&lt;/small&gt;&lt;/h4&gt;</span></code></li><li class="L5"><code class="lang-html"><span class="pln">    </span><span class="tag">&lt;p&gt;</span><span class="pln">千山鸟飞绝，万径人踪灭。</span><span class="tag">&lt;/p&gt;</span></code></li><li class="L6"><code class="lang-html"><span class="pln">    </span><span class="tag">&lt;p&gt;</span><span class="pln">孤舟蓑笠翁，独钓寒江雪。</span><span class="tag">&lt;/p&gt;</span></code></li><li class="L7"><code class="lang-html"><span class="pln">  </span><span class="tag">&lt;/div&gt;</span></code></li><li class="L8"><code class="lang-html"><span class="tag">&lt;/div&gt;</span></code></li><li class="L9"><code class="lang-html"><span class="tag">&lt;div</span><span class="pln"> </span><span class="atn">class</span><span class="pun">=</span><span class="atv">"popover right"</span><span class="tag">&gt;</span></code></li><li class="L0"><code class="lang-html"><span class="pln">  </span><span class="tag">&lt;div</span><span class="pln"> </span><span class="atn">class</span><span class="pun">=</span><span class="atv">"arrow"</span><span class="tag">&gt;&lt;/div&gt;</span></code></li><li class="L1"><code class="lang-html"><span class="pln">  </span><span class="tag">&lt;h3</span><span class="pln"> </span><span class="atn">class</span><span class="pun">=</span><span class="atv">"popover-title"</span><span class="tag">&gt;</span><span class="pln">从右侧弹出</span><span class="tag">&lt;/h3&gt;</span></code></li><li class="L2"><code class="lang-html"><span class="pln">  </span><span class="tag">&lt;div</span><span class="pln"> </span><span class="atn">class</span><span class="pun">=</span><span class="atv">"popover-content"</span><span class="tag">&gt;</span></code></li><li class="L3"><code class="lang-html"><span class="pln">    </span><span class="tag">&lt;h4&gt;</span><span class="pln">江雪 </span><span class="tag">&lt;small&gt;</span><span class="pln">唐·柳宗元</span><span class="tag">&lt;/small&gt;&lt;/h4&gt;</span></code></li><li class="L4"><code class="lang-html"><span class="pln">    </span><span class="tag">&lt;p&gt;</span><span class="pln">千山鸟飞绝，万径人踪灭。</span><span class="tag">&lt;/p&gt;</span></code></li><li class="L5"><code class="lang-html"><span class="pln">    </span><span class="tag">&lt;p&gt;</span><span class="pln">孤舟蓑笠翁，独钓寒江雪。</span><span class="tag">&lt;/p&gt;</span></code></li><li class="L6"><code class="lang-html"><span class="pln">  </span><span class="tag">&lt;/div&gt;</span></code></li><li class="L7"><code class="lang-html"><span class="tag">&lt;/div&gt;</span></code></li><li class="L8"><code class="lang-html"><span class="tag">&lt;div</span><span class="pln"> </span><span class="atn">class</span><span class="pun">=</span><span class="atv">"popover bottom"</span><span class="tag">&gt;</span></code></li><li class="L9"><code class="lang-html"><span class="pln">  </span><span class="tag">&lt;div</span><span class="pln"> </span><span class="atn">class</span><span class="pun">=</span><span class="atv">"arrow"</span><span class="tag">&gt;&lt;/div&gt;</span></code></li><li class="L0"><code class="lang-html"><span class="pln">  </span><span class="tag">&lt;h3</span><span class="pln"> </span><span class="atn">class</span><span class="pun">=</span><span class="atv">"popover-title"</span><span class="tag">&gt;</span><span class="pln">从下方弹出</span><span class="tag">&lt;/h3&gt;</span></code></li><li class="L1"><code class="lang-html"><span class="pln">  </span><span class="tag">&lt;div</span><span class="pln"> </span><span class="atn">class</span><span class="pun">=</span><span class="atv">"popover-content"</span><span class="tag">&gt;</span></code></li><li class="L2"><code class="lang-html"><span class="pln">    </span><span class="tag">&lt;h4&gt;</span><span class="pln">江雪 </span><span class="tag">&lt;small&gt;</span><span class="pln">唐·柳宗元</span><span class="tag">&lt;/small&gt;&lt;/h4&gt;</span></code></li><li class="L3"><code class="lang-html"><span class="pln">    </span><span class="tag">&lt;p&gt;</span><span class="pln">千山鸟飞绝，万径人踪灭。</span><span class="tag">&lt;/p&gt;</span></code></li><li class="L4"><code class="lang-html"><span class="pln">    </span><span class="tag">&lt;p&gt;</span><span class="pln">孤舟蓑笠翁，独钓寒江雪。</span><span class="tag">&lt;/p&gt;</span></code></li><li class="L5"><code class="lang-html"><span class="pln">  </span><span class="tag">&lt;/div&gt;</span></code></li><li class="L6"><code class="lang-html"><span class="tag">&lt;/div&gt;</span></code></li><li class="L7"><code class="lang-html"><span class="tag">&lt;div</span><span class="pln"> </span><span class="atn">class</span><span class="pun">=</span><span class="atv">"popover left"</span><span class="tag">&gt;</span></code></li><li class="L8"><code class="lang-html"><span class="pln">  </span><span class="tag">&lt;div</span><span class="pln"> </span><span class="atn">class</span><span class="pun">=</span><span class="atv">"arrow"</span><span class="tag">&gt;&lt;/div&gt;</span></code></li><li class="L9"><code class="lang-html"><span class="pln">  </span><span class="tag">&lt;h3</span><span class="pln"> </span><span class="atn">class</span><span class="pun">=</span><span class="atv">"popover-title"</span><span class="tag">&gt;</span><span class="pln">从左侧弹出</span><span class="tag">&lt;/h3&gt;</span></code></li><li class="L0"><code class="lang-html"><span class="pln">  </span><span class="tag">&lt;div</span><span class="pln"> </span><span class="atn">class</span><span class="pun">=</span><span class="atv">"popover-content"</span><span class="tag">&gt;</span></code></li><li class="L1"><code class="lang-html"><span class="pln">    </span><span class="tag">&lt;h4&gt;</span><span class="pln">江雪 </span><span class="tag">&lt;small&gt;</span><span class="pln">唐·柳宗元</span><span class="tag">&lt;/small&gt;&lt;/h4&gt;</span></code></li><li class="L2"><code class="lang-html"><span class="pln">    </span><span class="tag">&lt;p&gt;</span><span class="pln">千山鸟飞绝，万径人踪灭。</span><span class="tag">&lt;/p&gt;</span></code></li><li class="L3"><code class="lang-html"><span class="pln">    </span><span class="tag">&lt;p&gt;</span><span class="pln">孤舟蓑笠翁，独钓寒江雪。</span><span class="tag">&lt;/p&gt;</span></code></li><li class="L4"><code class="lang-html"><span class="pln">  </span><span class="tag">&lt;/div&gt;</span></code></li><li class="L5"><code class="lang-html"><span class="tag">&lt;/div&gt;</span></code></li><li class="L6"><code class="lang-html"><span class="tag">&lt;div</span><span class="pln"> </span><span class="atn">class</span><span class="pun">=</span><span class="atv">"popover left"</span><span class="tag">&gt;</span></code></li><li class="L7"><code class="lang-html"><span class="pln">  </span><span class="tag">&lt;h3</span><span class="pln"> </span><span class="atn">class</span><span class="pun">=</span><span class="atv">"popover-title"</span><span class="tag">&gt;</span><span class="pln">不带箭头</span><span class="tag">&lt;/h3&gt;</span></code></li><li class="L8"><code class="lang-html"><span class="pln">  </span><span class="tag">&lt;div</span><span class="pln"> </span><span class="atn">class</span><span class="pun">=</span><span class="atv">"popover-content"</span><span class="tag">&gt;</span></code></li><li class="L9"><code class="lang-html"><span class="pln">    </span><span class="tag">&lt;h4&gt;</span><span class="pln">江雪 </span><span class="tag">&lt;small&gt;</span><span class="pln">唐·柳宗元</span><span class="tag">&lt;/small&gt;&lt;/h4&gt;</span></code></li><li class="L0"><code class="lang-html"><span class="pln">    </span><span class="tag">&lt;p&gt;</span><span class="pln">千山鸟飞绝，万径人踪灭。</span><span class="tag">&lt;/p&gt;</span></code></li><li class="L1"><code class="lang-html"><span class="pln">    </span><span class="tag">&lt;p&gt;</span><span class="pln">孤舟蓑笠翁，独钓寒江雪。</span><span class="tag">&lt;/p&gt;</span></code></li><li class="L2"><code class="lang-html"><span class="pln">  </span><span class="tag">&lt;/div&gt;</span></code></li><li class="L3"><code class="lang-html"><span class="tag">&lt;/div&gt;</span></code></li></ol></pre></article></section>




<section><header><h3>动态演示</h3></header><article><div class="example">
  <button class="btn btn-danger" data-toggle="popover" title="" data-content="千山鸟飞绝，万径人踪灭。" data-original-title="江雪">显示/隐藏弹出面板</button>
</div><pre class="prettyprint prettyprinted" style=""><code class="lang-html"><span class="tag">&lt;button</span><span class="pln"> </span><span class="atn">class</span><span class="pun">=</span><span class="atv">"btn btn-danger"</span><span class="pln"> </span><span class="atn">data-toggle</span><span class="pun">=</span><span class="atv">"popover"</span><span class="pln"> </span><span class="atn">title</span><span class="pun">=</span><span class="atv">"江雪"</span><span class="pln"> </span><span class="atn">data-content</span><span class="pun">=</span><span class="atv">"千山鸟飞绝，万径人踪灭。"</span><span class="tag">&gt;</span><span class="pln">显示/隐藏弹出面板</span><span class="tag">&lt;/button&gt;</span></code></pre><pre class="prettyprint prettyprinted" style=""><code class="lang-js"><span class="com">// 你需要手动进行初始化</span><span class="pln">
$</span><span class="pun">(</span><span class="str">'[data-toggle="popover"]'</span><span class="pun">).</span><span class="pln">popover</span><span class="pun">();</span></code></pre></article></section>








<section><header><h3>弹出方向</h3></header><article><p>使用 <code>placement</code> 选项来指定相对于元素显示的位置。</p><div class="example text-center">
  <button type="button" class="btn" data-toggle="popover" data-placement="left" data-content="千山鸟飞绝，万径人踪灭。" title="" data-original-title="江雪">从左侧弹出</button>
  <button type="button" class="btn" data-toggle="popover" data-placement="top" data-content="千山鸟飞绝，万径人踪灭。" title="" data-original-title="江雪">从上方弹出</button>
  <button type="button" class="btn" data-toggle="popover" data-placement="bottom" data-content="千山鸟飞绝，万径人踪灭。" title="" data-original-title="江雪">从下方弹出</button>
  <button type="button" class="btn" data-toggle="popover" data-placement="right" data-content="千山鸟飞绝，万径人踪灭。" title="" data-original-title="江雪">从右侧弹出</button>
</div><pre class="prettyprint prettyprinted" style=""><code class="lang-html"><span class="tag">&lt;button</span><span class="pln"> </span><span class="atn">type</span><span class="pun">=</span><span class="atv">"button"</span><span class="pln"> </span><span class="atn">class</span><span class="pun">=</span><span class="atv">"btn"</span><span class="pln"> </span><span class="atn">data-toggle</span><span class="pun">=</span><span class="atv">"popover"</span><span class="pln"> </span><span class="atn">data-placement</span><span class="pun">=</span><span class="atv">"left"</span><span class="pln"> </span><span class="atn">data-content</span><span class="pun">=</span><span class="atv">"千山鸟飞绝，万径人踪灭。"</span><span class="pln"> </span><span class="atn">title</span><span class="pun">=</span><span class="atv">"江雪"</span><span class="tag">&gt;</span><span class="pln">从左侧弹出</span><span class="tag">&lt;/button&gt;</span></code></pre><pre class="prettyprint prettyprinted" style=""><code class="lang-html"><span class="tag">&lt;button</span><span class="pln"> </span><span class="atn">type</span><span class="pun">=</span><span class="atv">"button"</span><span class="pln"> </span><span class="atn">class</span><span class="pun">=</span><span class="atv">"btn"</span><span class="pln"> </span><span class="atn">data-toggle</span><span class="pun">=</span><span class="atv">"popover"</span><span class="pln"> </span><span class="atn">data-placement</span><span class="pun">=</span><span class="atv">"top"</span><span class="pln"> </span><span class="atn">data-content</span><span class="pun">=</span><span class="atv">"千山鸟飞绝，万径人踪灭。"</span><span class="pln"> </span><span class="atn">title</span><span class="pun">=</span><span class="atv">"江雪"</span><span class="tag">&gt;</span><span class="pln">从上方弹出</span><span class="tag">&lt;/button&gt;</span></code></pre><pre class="prettyprint prettyprinted" style=""><code class="lang-html"><span class="tag">&lt;button</span><span class="pln"> </span><span class="atn">type</span><span class="pun">=</span><span class="atv">"button"</span><span class="pln"> </span><span class="atn">class</span><span class="pun">=</span><span class="atv">"btn"</span><span class="pln"> </span><span class="atn">data-toggle</span><span class="pun">=</span><span class="atv">"popover"</span><span class="pln"> </span><span class="atn">data-placement</span><span class="pun">=</span><span class="atv">"bottom"</span><span class="pln"> </span><span class="atn">data-content</span><span class="pun">=</span><span class="atv">"千山鸟飞绝，万径人踪灭。"</span><span class="pln"> </span><span class="atn">title</span><span class="pun">=</span><span class="atv">"江雪"</span><span class="tag">&gt;</span><span class="pln">从下方弹出</span><span class="tag">&lt;/button&gt;</span></code></pre><pre class="prettyprint prettyprinted" style=""><code class="lang-html"><span class="tag">&lt;button</span><span class="pln"> </span><span class="atn">type</span><span class="pun">=</span><span class="atv">"button"</span><span class="pln"> </span><span class="atn">class</span><span class="pun">=</span><span class="atv">"btn"</span><span class="pln"> </span><span class="atn">data-toggle</span><span class="pun">=</span><span class="atv">"popover"</span><span class="pln"> </span><span class="atn">data-placement</span><span class="pun">=</span><span class="atv">"right"</span><span class="pln"> </span><span class="atn">data-content</span><span class="pun">=</span><span class="atv">"千山鸟飞绝，万径人踪灭。"</span><span class="pln"> </span><span class="atn">title</span><span class="pun">=</span><span class="atv">"江雪"</span><span class="tag">&gt;</span><span class="pln">从右侧弹出</span><span class="tag">&lt;/button&gt;</span></code></pre><pre class="prettyprint prettyprinted" style=""><code class="lang-js"><span class="com">// 或者在初始化时指定弹出方向</span><span class="pln">
$</span><span class="pun">(</span><span class="str">'[data-toggle="popover"]'</span><span class="pun">).</span><span class="pln">popover</span><span class="pun">({</span><span class="pln">
    placement</span><span class="pun">:</span><span class="pln"> </span><span class="str">'bottom'</span><span class="pln">
</span><span class="pun">});</span></code></pre></article></section>



<section>
  <header><h3>外观</h3></header>
  <article><p>使用 <code>tipClass</code> 指定外观类名来更改颜色主题。</p><div class="example text-center">
  <button type="button" class="btn btn-primary" data-toggle="popover" data-tip-class="popover-primary" data-content="千山鸟飞绝，万径人踪灭。" title="" data-placement="left" data-original-title="江雪">.popover-primary</button>
  <button type="button" class="btn btn-success" data-toggle="popover" data-tip-class="popover-success" data-content="千山鸟飞绝，万径人踪灭。" title="" data-placement="top" data-original-title="江雪">.popover-success</button>
  <button type="button" class="btn btn-info" data-toggle="popover" data-tip-class="popover-info" data-content="千山鸟飞绝，万径人踪灭。" title="" data-placement="bottom" data-original-title="江雪">.popover-info</button>
  <button type="button" class="btn btn-warning" data-toggle="popover" data-tip-class="popover-warning" data-content="千山鸟飞绝，万径人踪灭。" title="" data-placement="top" data-original-title="江雪">.popover-warning</button>
  <button type="button" class="btn btn-danger" data-toggle="popover" data-tip-class="popover-danger" data-content="千山鸟飞绝，万径人踪灭。" title="" data-placement="right" data-original-title="江雪">.popover-danger</button>
</div><pre class="prettyprint prettyprinted" style=""><code class="lang-html"><span class="tag">&lt;button</span><span class="pln"> </span><span class="atn">type</span><span class="pun">=</span><span class="atv">"button"</span><span class="pln"> </span><span class="atn">class</span><span class="pun">=</span><span class="atv">"btn btn-primary"</span><span class="pln"> </span><span class="atn">data-toggle</span><span class="pun">=</span><span class="atv">"popover"</span><span class="pln"> </span><span class="atn">data-tip-class</span><span class="pun">=</span><span class="atv">"popover-primary"</span><span class="pln"> </span><span class="atn">data-content</span><span class="pun">=</span><span class="atv">"千山鸟飞绝，万径人踪灭。"</span><span class="pln"> </span><span class="atn">title</span><span class="pun">=</span><span class="atv">"江雪"</span><span class="pln"> </span><span class="atn">data-placement</span><span class="pun">=</span><span class="atv">"left"</span><span class="tag">&gt;</span><span class="pln">.popover-primary</span><span class="tag">&lt;/button&gt;</span></code></pre><pre class="prettyprint prettyprinted" style=""><code class="lang-html"><span class="tag">&lt;button</span><span class="pln"> </span><span class="atn">type</span><span class="pun">=</span><span class="atv">"button"</span><span class="pln"> </span><span class="atn">class</span><span class="pun">=</span><span class="atv">"btn btn-success"</span><span class="pln"> </span><span class="atn">data-toggle</span><span class="pun">=</span><span class="atv">"popover"</span><span class="pln"> </span><span class="atn">data-tip-class</span><span class="pun">=</span><span class="atv">"popover-success"</span><span class="pln"> </span><span class="atn">data-content</span><span class="pun">=</span><span class="atv">"千山鸟飞绝，万径人踪灭。"</span><span class="pln"> </span><span class="atn">title</span><span class="pun">=</span><span class="atv">"江雪"</span><span class="pln"> </span><span class="atn">data-placement</span><span class="pun">=</span><span class="atv">"top"</span><span class="tag">&gt;</span><span class="pln">.popover-success</span><span class="tag">&lt;/button&gt;</span></code></pre><pre class="prettyprint prettyprinted" style=""><code class="lang-html"><span class="tag">&lt;button</span><span class="pln"> </span><span class="atn">type</span><span class="pun">=</span><span class="atv">"button"</span><span class="pln"> </span><span class="atn">class</span><span class="pun">=</span><span class="atv">"btn btn-info"</span><span class="pln"> </span><span class="atn">data-toggle</span><span class="pun">=</span><span class="atv">"popover"</span><span class="pln"> </span><span class="atn">data-tip-class</span><span class="pun">=</span><span class="atv">"popover-info"</span><span class="pln"> </span><span class="atn">data-content</span><span class="pun">=</span><span class="atv">"千山鸟飞绝，万径人踪灭。"</span><span class="pln"> </span><span class="atn">title</span><span class="pun">=</span><span class="atv">"江雪"</span><span class="pln"> </span><span class="atn">data-placement</span><span class="pun">=</span><span class="atv">"bottom"</span><span class="tag">&gt;</span><span class="pln">.popover-info</span><span class="tag">&lt;/button&gt;</span></code></pre><pre class="prettyprint prettyprinted" style=""><code class="lang-html"><span class="tag">&lt;button</span><span class="pln"> </span><span class="atn">type</span><span class="pun">=</span><span class="atv">"button"</span><span class="pln"> </span><span class="atn">class</span><span class="pun">=</span><span class="atv">"btn btn-warning"</span><span class="pln"> </span><span class="atn">data-toggle</span><span class="pun">=</span><span class="atv">"popover"</span><span class="pln"> </span><span class="atn">data-tip-class</span><span class="pun">=</span><span class="atv">"popover-warning"</span><span class="pln"> </span><span class="atn">data-content</span><span class="pun">=</span><span class="atv">"千山鸟飞绝，万径人踪灭。"</span><span class="pln"> </span><span class="atn">title</span><span class="pun">=</span><span class="atv">"江雪"</span><span class="pln"> </span><span class="atn">data-placement</span><span class="pun">=</span><span class="atv">"top"</span><span class="tag">&gt;</span><span class="pln">.popover-warning</span><span class="tag">&lt;/button&gt;</span></code></pre><pre class="prettyprint prettyprinted" style=""><code class="lang-html"><span class="tag">&lt;button</span><span class="pln"> </span><span class="atn">type</span><span class="pun">=</span><span class="atv">"button"</span><span class="pln"> </span><span class="atn">class</span><span class="pun">=</span><span class="atv">"btn btn-danger"</span><span class="pln"> </span><span class="atn">data-toggle</span><span class="pun">=</span><span class="atv">"popover"</span><span class="pln"> </span><span class="atn">data-tip-class</span><span class="pun">=</span><span class="atv">"popover-danger"</span><span class="pln"> </span><span class="atn">data-content</span><span class="pun">=</span><span class="atv">"千山鸟飞绝，万径人踪灭。"</span><span class="pln"> </span><span class="atn">title</span><span class="pun">=</span><span class="atv">"江雪"</span><span class="pln"> </span><span class="atn">data-placement</span><span class="pun">=</span><span class="atv">"right"</span><span class="tag">&gt;</span><span class="pln">.popover-danger</span><span class="tag">&lt;/button&gt;</span></code></pre><pre class="prettyprint prettyprinted" style=""><code class="lang-js"><span class="com">// 或者在初始化时指定外观选项</span><span class="pln">
$</span><span class="pun">(</span><span class="str">'[data-toggle="popover"]'</span><span class="pun">).</span><span class="pln">popover</span><span class="pun">({</span><span class="pln">
    tipClass</span><span class="pun">:</span><span class="pln"> </span><span class="str">'danger'</span><span class="pln">
</span><span class="pun">});</span></code></pre></article></section>

<script>
$(function(){
  $('[data-toggle="popover"]').popover();
})
</script>

<section>
  <header><h3>用法</h3></header>
  <article>
    <h4>初始化</h4>
    <p>出于性能方面的考虑，工具提示和弹框组件的data属性api是选择性加入的，也就是说 <strong>你必须自己初始化他们</strong>。</p>
    <ul>
<li><code>$().popover()</code></li>
<li><code>$().popover(options)</code></li>
</ul><p>参数 <code>options</code> 用于设置初始化选项，是可以选的。初始化选项也可以通过元素上的 <code>[data-*]</code> 属性来设置。</p><h4>选项</h4><p>可用的初始化选项如下：</p><div class="table-responsive"><table class="table table-bordered table-striped">
  <thead>
    <tr>
      <th style="width: 100px;">名称</th>
      <th style="width: 100px;">类型</th>
      <th style="width: 50px;">默认值</th>
      <th>描述</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td><code>animation</code></td>
      <td><code>true</code>、<code>false</code></td>
      <td><code>true</code></td>
      <td>是否应用淡入淡出动画。</td>
    </tr>
    <tr>
      <td><code>container</code></td>
      <td>字符串或 <code>false</code></td>
      <td><code>false</code></td>
      <td>可以设置为一个 CSS 选择器字符串用于指定动态创建的弹出面板元素被添加到的父级容器元素，例如 <code>container: 'body'</code>。默认为 <code>false</code>，此时动态创建的弹出面板元素被添加到触发元素所在的父级元素。</td>
    </tr>
    <tr>
      <td><code>content</code></td>
      <td>字符串或函数</td>
      <td><code>''</code></td>
      <td>用设定弹出面板显示的内容，如果指定为函数，则应该在函数内返回用于内容的字符串。</td>
    </tr>
    <tr>
      <td><code>delay</code></td>
      <td>数字或对象</td>
      <td><code>0</code></td>
      <td>如果指定为数字，则在指定数值的毫秒数后再显示。如果指定为对象，则可以分别为显示或隐藏之前延迟的数值，例如：<code>delay: { show: 500, hide: 100 }</code>。</td>
    </tr>
    <tr>
      <td><code>html</code></td>
      <td><code>true</code>、<code>false</code></td>
      <td><code>false</code></td>
      <td>是否允许弹出面板内容包含 HTML 格式源码。如果设置为 false，则仅仅使用 jQuery 的 text() 方法来设置弹出面板内容。</td>
    </tr>
    <tr>
      <td><code>placement</code></td>
      <td>字符串或函数</td>
      <td><code>'right'</code></td>
      <td>设置弹出面板显示的位置，可选值有：<code>'top'</code>, <code>'bottom'</code>, <code>'left'</code>, <code>'right'</code>, <code>'auto'</code>。如果设置为 <code>'auto'</code>，则会自动决定位置。也可以指定为一个函数，来动态返回应该显示的位置。</td>
    </tr>
    <tr>
      <td><code>selector</code></td>
      <td>字符串或 <code>false</code></td>
      <td><code>false</code></td>
      <td>如果指定了该选项，则会在代理元素来触发显示弹出面板，这样可以对于一些动态内容使用弹出面板。</td>
    </tr>
    <tr>
      <td><code>template</code></td>
      <td>字符串</td>
      <td><code>'&lt;div class="popover"&gt;&lt;div class="arrow"&gt;&lt;/div&gt;&lt;h3 class="popover-title"&gt;&lt;/h3&gt;&lt;div class="popover-content"&gt;&lt;/div&gt;&lt;/div&gt;'</code></td>
      <td>HTML 模板字符串用来创建弹出面板显示内容元素。要求顶级元素必须有 <code>.popover</code> 类，弹出面板的内容会设置为 <code>.popover-content</code> 的内容，标题会设置为 <code>.popover-title</code> 的内容，<code>.arrow</code> 将作为箭头元素。</td>
    </tr>
    <tr>
      <td><code>title</code></td>
      <td>字符串或函数</td>
      <td><code>''</code></td>
      <td>用设定弹出面板显示的标题，如果指定为函数，则应该在函数内返回用于标题的字符串。</td>
    </tr>
    <tr>
      <td><code>trigger</code></td>
      <td><code>string</code></td>
      <td><code>'click'</code></td>
      <td>指定哪些事件会触发显示弹出面板，多个事件用空格隔开，可选值包括：<code>'click'</code>、<code>'hover'</code>、<code>'focus'</code>、<code>'manual'</code>。如果设定为 <code>'manual'</code> 则需要用户通过 JavaScript 手动显示或隐藏弹出面板。</td>
    </tr>
    <tr>
      <td><code>tipClass</code></td>
      <td>字符串</td>
      <td><code>''</code></td>
      <td>为动态生成的 <code>.popover</code> 元素添加额外的 CSS 类。</td>
    </tr>
    <tr>
      <td><code>tipId</code></td>
      <td>字符串</td>
      <td><code>''</code></td>
      <td>为动态生成的 <code>.popover</code> 元素设置 ID 属性。</td>
    </tr>
  </tbody>
</table></div><h4>方法</h4><h5><span class="code">$().popover('show')</span></h5><p>显示弹出框。</p><pre class="prettyprint prettyprinted" style=""><code class="lang-js"><span class="pln">$</span><span class="pun">(</span><span class="str">'#myPopover'</span><span class="pun">).</span><span class="pln">popover</span><span class="pun">(</span><span class="str">'show'</span><span class="pun">);</span></code></pre><h5><span class="code">$().popover('hide')</span></h5><p>隐藏弹出框。</p><pre class="prettyprint prettyprinted" style=""><code class="lang-js"><span class="pln">$</span><span class="pun">(</span><span class="str">'#myPopover'</span><span class="pun">).</span><span class="pln">popover</span><span class="pun">(</span><span class="str">'hide'</span><span class="pun">);</span></code></pre><h5><span class="code">$().popover('toggle')</span></h5><p>展示或隐藏弹出框。</p><pre class="prettyprint prettyprinted" style=""><code class="lang-js"><span class="pln">$</span><span class="pun">(</span><span class="str">'#myPopover'</span><span class="pun">).</span><span class="pln">popover</span><span class="pun">(</span><span class="str">'toggle'</span><span class="pun">);</span></code></pre><h5><span class="code">$().popover('destroy')</span></h5><p>隐藏并销毁弹出框。</p><pre class="prettyprint prettyprinted" style=""><code class="lang-js"><span class="pln">$</span><span class="pun">(</span><span class="str">'#myPopover'</span><span class="pun">).</span><span class="pln">popover</span><span class="pun">(</span><span class="str">'destroy'</span><span class="pun">);</span></code></pre><h4>事件</h4><p>当弹出面板显示或隐藏时会在触发元素上触发如下事件：</p><div class="table-responsive"><table class="table table-bordered">
  <thead>
    <tr>
      <th style="width: 150px;">事件类型</th>
      <th>描述</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td><code>show.zui.popover</code></td>
      <td>当 <code>show</code>方法被调用之后，此事件将被立即触发。</td>
    </tr>
    <tr>
      <td><code>shown.zui.popover</code></td>
      <td>当弹出框展示到用户面前之后（同时CSS过渡效果执行完之后）此事件被触发。</td>
    </tr>
    <tr>
      <td><code>hide.zui.popover</code></td>
      <td>当 <code>hide</code>方法被调用之后，此事件被触发。</td>
    </tr>
    <tr>
      <td><code>hidden.zui.popover</code></td>
      <td>当弹出框被隐藏之后（同时 CSS 过渡效果执行完之后），此事件被触发。</td>
    </tr>
  </tbody>
</table></div><h4>使用要点</h4><ul>
<li>弹出框依赖 <a href="#javascript/tooltips">工具提示插件</a> ，因此需要先加载工具提示插件。</li>
<li>弹出框在按钮组和输入框组中使用时，需要额外的设置：当提示框与 <code>.btn-group</code> 或 <code>.input-group</code> 联合使用时，你需要指定 <code>container: 'body'</code>选项（见下面的文档）以避免不需要的副作用（例如，当弹出框显示之后，与其合作的页面元素可能变得更宽或是去圆角）。</li>
<li>在禁止使用的页面元素上使用弹出框时需要额外增加一个元素将其包裹起来：为了给 <code>disabled</code> 或 <code>.disabled</code> 元素添加弹出框时，将需要增加弹出框的页面元素包裹在一个 <code>&lt;div&gt;</code> 中，然后对这个 <code>&lt;div&gt;</code> 元素应用弹出框。</li>
</ul></article></section></div>
</section>
{/block}